using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class DataManger
{
    private static DataManger instance = new DataManger();
    public static DataManger Instance => instance;
    public InputConf InputConf => inputConf;

    private InputConf inputConf;
    private string jsonStr;
    private DataManger()
    {
        inputConf = new InputConf();
        jsonStr = Resources.Load<TextAsset>("Lesson17PlayerInput").text;
    }

    public InputActionAsset GetActionAsset()
    {
        string str = jsonStr.Replace("<up>", inputConf.up);
        str = str.Replace("<down>", inputConf.down);
        str = str.Replace("<left>", inputConf.left);
        str = str.Replace("<right>", inputConf.right);
        str = str.Replace("<fire>", inputConf.fire);
        str = str.Replace("<jump>", inputConf.jump);
        return InputActionAsset.FromJson(str);
    }
}
